| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

StringView.h
1 // StringView.h
3 //
5
6 namespace nkMemory
7 {
21 class StringView final
22 {
23 public :
24
29 StringView () noexcept ;
36 StringView (const char* data) noexcept ;
45 StringView (const char* data, unsigned long long size) noexcept ;
51 StringView (const nkLog::StringView& logStr) noexcept ;
58 StringView (const String& other) noexcept ;
64 StringView (const StringView& other) noexcept ;
70 StringView (StringView&& other) noexcept ;
71
72 // Getters
76 const char* getData () const ;
80 unsigned long long getSize () const ;
84 bool empty () const ;
88 char front () const ;
92 char back () const ;
96 const char* begin () const ;
100 char* begin () ;
104 const char* end () const ;
108 unsigned char* end () ;
109
110 // Utils
117 BufferCast<StringView> split (StringView separator) ;
118
119 // Operators
125 StringView& operator= (const char* data) noexcept ;
131 StringView& operator= (const String& other) noexcept ;
137 StringView& operator= (const StringView& other) noexcept ;
143 StringView& operator= (StringView&& other) noexcept ;
149 char operator[] (unsigned long long index) const ;
156 String operator+ (char c) const ;
163 String operator+ (const char* data) const ;
170 String operator+ (const StringView& other) const ;
177 bool operator== (const char* other) const ;
184 bool operator== (const StringView& other) const ;
191 bool operator!= (const char* other) const ;
198 bool operator!= (const StringView& other) const ;
199
200 public :
201
208 template<typename T = std::string>
209 StringView (const std::string& str) noexcept ;
218 template<typename T = std::string>
219 StringView (const std::string& str, unsigned long long index, unsigned long long size = 0ull) noexcept ;
226 template<typename T = std::string_view>
227 StringView (const std::string_view& str) noexcept ;
236 template<typename T = std::string_view>
237 StringView (const std::string_view& str, unsigned long long index, unsigned long long size = 0ull) noexcept ;
238
239 public :
240
244 operator std::string () const ;
248 operator std::string_view () const ;
252 operator nkLog::String () const ;
256 operator nkLog::StringView () const ;
257
264 StringView& operator= (const std::string& data) ;
271 StringView& operator= (const std::string_view& data) ;
272 } ;
273
281 inline bool operator== (const char* c, const nkMemory::StringView& str) ;
282 }
nkMemory::StringView::empty
bool empty() const
nkMemory::StringView::StringView
StringView() noexcept
nkMemory::StringView::split
BufferCast< StringView > split(StringView separator)
nkMemory::StringView::end
const char * end() const
nkLog
Encompasses all API of component NilkinsLog.
Definition: String.h:7
nkMemory::StringView::front
char front() const
nkMemory::StringView::getSize
unsigned long long getSize() const
nkMemory::StringView::getData
const char * getData() const
nkMemory::String
Class holding information about a string, with ownership over the data.
Definition: String.h:22
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::StringView::back
char back() const
nkMemory::StringView::begin
const char * begin() const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7